home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / PInterfaces / ADSP.p next >
Encoding:
Text File  |  1995-07-06  |  8.9 KB  |  244 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        ADSP.p
  3.  
  4.      Contains:    AppleTalk Data Stream Protocol (ADSP) Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT ADSP;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __ADSP__}
  30. {$SETC __ADSP__ := 1}
  31.  
  32. {$I+}
  33. {$SETC ADSPIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __ERRORS__}
  38. {$I Errors.p}
  39. {$ENDC}
  40. {    ConditionalMacros.p                                            }
  41.  
  42. {$IFC UNDEFINED __APPLETALK__}
  43. {$I AppleTalk.p}
  44. {$ENDC}
  45. {    Types.p                                                        }
  46. {    OSUtils.p                                                    }
  47. {        MixedMode.p                                                }
  48. {        Memory.p                                                }
  49.  
  50. {$PUSH}
  51. {$ALIGN MAC68K}
  52. {$LibExport+}
  53.  
  54. CONST
  55.     dspInit                        = 255;                            { create a new connection end }
  56.     dspRemove                    = 254;                            { remove a connection end }
  57.     dspOpen                        = 253;                            { open a connection }
  58.     dspClose                    = 252;                            { close a connection }
  59.     dspCLInit                    = 251;                            { create a connection listener }
  60.     dspCLRemove                    = 250;                            { remove a connection listener }
  61.     dspCLListen                    = 249;                            { post a listener request }
  62.     dspCLDeny                    = 248;                            { deny an open connection request }
  63.     dspStatus                    = 247;                            { get status of connection end }
  64.     dspRead                        = 246;                            { read data from the connection }
  65.     dspWrite                    = 245;                            { write data on the connection }
  66.     dspAttention                = 244;                            { send an attention message }
  67.  
  68.     dspOptions                    = 243;                            { set connection end options }
  69.     dspReset                    = 242;                            { forward reset the connection }
  70.     dspNewCID                    = 241;                            { generate a cid for a connection end }
  71. { connection opening modes }
  72.     ocRequest                    = 1;                            { request a connection with remote }
  73.     ocPassive                    = 2;                            { wait for a connection request from remote }
  74.     ocAccept                    = 3;                            { accept request as delivered by listener }
  75.     ocEstablish                    = 4;                            { consider connection to be open }
  76. { connection end states }
  77.     sListening                    = 1;                            { for connection listeners }
  78.     sPassive                    = 2;                            { waiting for a connection request from remote }
  79.     sOpening                    = 3;                            { requesting a connection with remote }
  80.     sOpen                        = 4;                            { connection is open }
  81.     sClosing                    = 5;                            { connection is being torn down }
  82.     sClosed                        = 6;                            { connection end state is closed }
  83. { client event flags }
  84.     eClosed                        = $80;                            { received connection closed advice }
  85.     eTearDown                    = $40;                            { connection closed due to broken connection }
  86.     eAttention                    = $20;                            { received attention message }
  87.     eFwdReset                    = $10;                            { received forward reset advice }
  88. { miscellaneous constants }
  89.     attnBufSize                    = 570;                            { size of client attention buffer }
  90.     minDSPQueueSize                = 100;                            { Minimum size of receive or send Queue }
  91.  
  92. { connection control block }
  93.  
  94. TYPE
  95.     TRCCB = PACKED RECORD
  96.         ccbLink:                ^TRCCB;                                    { link to next ccb }
  97.         refNum:                    UInt16;                                    { user reference number }
  98.         state:                    UInt16;                                    { state of the connection end }
  99.         userFlags:                UInt8;                                    { flags for unsolicited connection events }
  100.         localSocket:            UInt8;                                    { socket number of this connection end }
  101.         remoteAddress:            AddrBlock;                                { internet address of remote end }
  102.         attnCode:                UInt16;                                    { attention code received }
  103.         attnSize:                UInt16;                                    { size of received attention data }
  104.         attnPtr:                Ptr;                                    { ptr to received attention data }
  105.         reserved:                PACKED ARRAY [0..219] OF UInt8;            { for adsp internal use }
  106.     END;
  107.  
  108.     TPCCB = ^TRCCB;
  109.  
  110.     DSPPBPtr = ^DSPParamBlock;
  111.  
  112.     {
  113.         ADSPConnectionEventProcPtr uses register based parameters on the 68k and cannot
  114.         be written in or called from a high-level language without the help of
  115.         mixed mode or assembly glue.
  116.  
  117.         In:
  118.          => sourceCCB       A1.L
  119.     }
  120.     ADSPConnectionEventProcPtr = Register68kProcPtr;  { register PROCEDURE ADSPConnectionEvent(sourceCCB: TPCCB); }
  121.     {
  122.         ADSPCompletionProcPtr uses register based parameters on the 68k and cannot
  123.         be written in or called from a high-level language without the help of
  124.         mixed mode or assembly glue.
  125.  
  126.         In:
  127.          => thePBPtr        A0.L
  128.     }
  129.     ADSPCompletionProcPtr = Register68kProcPtr;  { register PROCEDURE ADSPCompletion(thePBPtr: DSPPBPtr); }
  130.     ADSPConnectionEventUPP = UniversalProcPtr;
  131.     ADSPCompletionUPP = UniversalProcPtr;
  132.  
  133.     DSPParamBlock = PACKED RECORD
  134.         qLink:                    ^QElem;
  135.         qType:                    INTEGER;
  136.         ioTrap:                    INTEGER;
  137.         ioCmdAddr:                Ptr;
  138.         ioCompletion:            ADSPCompletionUPP;
  139.         ioResult:                OSErr;
  140.         ioNamePtr:                StringPtr;
  141.         ioVRefNum:                INTEGER;
  142.         ioCRefNum:                INTEGER;                                { adsp driver refNum }
  143.         csCode:                    INTEGER;                                { adsp driver control code }
  144.         qStatus:                LONGINT;                                { adsp internal use }
  145.         ccbRefNum:                INTEGER;
  146.         CASE INTEGER OF
  147.         0: (
  148.             ccbPtr:                        TPCCB;                                { pointer to connection control block }
  149.             userRoutine:                ADSPConnectionEventUPP;                { client routine to call on event }
  150.             sendQSize:                    UInt16;                                { size of send queue (0..64K bytes) }
  151.             sendQueue:                    Ptr;                                { client passed send queue buffer }
  152.             recvQSize:                    UInt16;                                { size of receive queue (0..64K bytes) }
  153.             recvQueue:                    Ptr;                                { client passed receive queue buffer }
  154.             attnPtr:                    Ptr;                                { client passed receive attention buffer }
  155.             localSocket:                UInt8;                                { local socket number }
  156.             filler1:                    UInt8;                                { filler for proper byte alignment }
  157.            );
  158.         1: (
  159.             localCID:                    UInt16;                                { local connection id }
  160.             remoteCID:                    UInt16;                                { remote connection id }
  161.             remoteAddress:                AddrBlock;                            { address of remote end }
  162.             filterAddress:                AddrBlock;                            { address filter }
  163.             sendSeq:                    UInt32;                                { local send sequence number }
  164.             sendWindow:                    UInt16;                                { send window size }
  165.             recvSeq:                    UInt32;                                { receive sequence number }
  166.             attnSendSeq:                UInt32;                                { attention send sequence number }
  167.             attnRecvSeq:                UInt32;                                { attention receive sequence number }
  168.             ocMode:                        UInt8;                                { open connection mode }
  169.             ocInterval:                    UInt8;                                { open connection request retry interval }
  170.             ocMaximum:                    UInt8;                                { open connection request retry maximum }
  171.             filler2:                    UInt8;                                { filler for proper byte alignment }
  172.            );
  173.         2: (
  174.             abort:                        UInt8;                                { abort connection immediately if non-zero }
  175.             filler3:                    UInt8;                                { filler for proper byte alignment }
  176.            );
  177.         3: (
  178.             reqCount:                    UInt16;                                { requested number of bytes }
  179.             actCount:                    UInt16;                                { actual number of bytes }
  180.             dataPtr:                    Ptr;                                { pointer to data buffer }
  181.             eom:                        UInt8;                                { indicates logical end of message }
  182.             flush:                        UInt8;                                { send data now }
  183.            );
  184.         4: (
  185.             attnCode:                    UInt16;                                { client attention code }
  186.             attnSize:                    UInt16;                                { size of attention data }
  187.             attnData:                    Ptr;                                { pointer to attention data }
  188.             attnInterval:                UInt8;                                { retransmit timer in 10-tick intervals }
  189.             filler4:                    UInt8;                                { filler for proper byte alignment }
  190.            );
  191.         5: (
  192.             statusCCB:                    TPCCB;                                { pointer to ccb }
  193.             sendQPending:                UInt16;                                { pending bytes in send queue }
  194.             sendQFree:                    UInt16;                                { available buffer space in send queue }
  195.             recvQPending:                UInt16;                                { pending bytes in receive queue }
  196.             recvQFree:                    UInt16;                                { available buffer space in receive queue }
  197.            );
  198.         6: (
  199.             sendBlocking:                UInt16;                                { quantum for data packets }
  200.             sendTimer:                    UInt8;                                { send timer in 10-tick intervals }
  201.             rtmtTimer:                    UInt8;                                { retransmit timer in 10-tick intervals }
  202.             badSeqMax:                    UInt8;                                { threshold for sending retransmit advice }
  203.             useCheckSum:                UInt8;                                { use ddp packet checksum }
  204.            );
  205.         7: (
  206.             newcid:                        UInt16;                                { new connection id returned }
  207.            );
  208.     END;
  209.  
  210. CONST
  211.     uppADSPConnectionEventProcInfo = $0000B802; { Register PROCEDURE (4 bytes in A1); }
  212.     uppADSPCompletionProcInfo = $00009802; { Register PROCEDURE (4 bytes in A0); }
  213.  
  214. FUNCTION NewADSPConnectionEventProc(userRoutine: ADSPConnectionEventProcPtr): ADSPConnectionEventUPP;
  215.     {$IFC NOT GENERATINGCFM }
  216.     INLINE $2E9F;
  217.     {$ENDC}
  218.  
  219. FUNCTION NewADSPCompletionProc(userRoutine: ADSPCompletionProcPtr): ADSPCompletionUPP;
  220.     {$IFC NOT GENERATINGCFM }
  221.     INLINE $2E9F;
  222.     {$ENDC}
  223.  
  224. PROCEDURE CallADSPConnectionEventProc(sourceCCB: TPCCB; userRoutine: ADSPConnectionEventUPP);
  225.     {$IFC NOT GENERATINGCFM}
  226.     {To be implemented:  Glue to move parameters into registers.}
  227.     {$ENDC}
  228.  
  229. PROCEDURE CallADSPCompletionProc(thePBPtr: DSPPBPtr; userRoutine: ADSPCompletionUPP);
  230.     {$IFC NOT GENERATINGCFM}
  231.     {To be implemented:  Glue to move parameters into registers.}
  232.     {$ENDC}
  233.  
  234. {$ALIGN RESET}
  235. {$POP}
  236.  
  237. {$SETC UsingIncludes := ADSPIncludes}
  238.  
  239. {$ENDC} {__ADSP__}
  240.  
  241. {$IFC NOT UsingIncludes}
  242.  END.
  243. {$ENDC}
  244.